import { cardPaid, cardSize, cardColor, Card, CardJokerType, JokerCard, PlayingCard, CardArr } from "./types";

export function createCardPaid() {
    const result: CardArr = [];
    const cardSizes = Object.values(cardSize);
    const cardColors = Object.values(cardColor);
    function getString() {
        return this.color + " " + this.size;
    }
    for (const size of cardSizes) {
        for (const color of cardColors) {
            result.push(<Card>{
                color: color,
                size: size,
                getString,
            });
        }
    }
    const smallJoker = {
        type: CardJokerType.small,
        getString(){
            return "small Joker";
        },
    };
    const bigJoker = {
        type: CardJokerType.big,
        getString(){
            return "big Joker";
        },
    };
    result.push(smallJoker);
    result.push(bigJoker);
    return result;
} 
export function printCardPaid(cardPaid: CardArr): void {
    let result: string = "";
    cardPaid.forEach((card, index) => {
        result += card.getString() + "\t";
        if ((index + 1) % 6 === 0) {
            console.log(result);
            result = "";
        }
    });
}
export { CardArr };

